from multiprocessing import Queue, Process
import os
import time
import random

# x = [1,2]
# print(x)

q = Queue()


def worker1(x):
    print('worker1-->', os.getpid())
    # print(x[0] + 1)
    # x.put(random.randint(1,10))
    x.put(1)


def worker2(x):
    print('worker2-->', os.getpid())
    # print(x[0] + 1)
    # x.put(random.randint(1,10))
    x.put('a')


if __name__ == '__main__':
    p1 = Process(target=worker1, args=(q,))

    p1.start()
    for i in range(1, 10):
        p2 = Process(target=worker2, args=(q,))
        p2.start()
        p2.join()
    p1.join()
    print(q.qsize())
    for i in range(q.qsize()):
        print(q.get_nowait())
    print('over.......')
